/**
 * Project Name:youba
 * Package Name:com.inoneone.youba.mcht.util
 * Date:2017/7/2下午8:29
 * Copyright (c) 2017, www.zbj.com All Rights Reserved
 */
package com.inoneone.youba.mcht.util;

import org.mybatis.generator.api.GeneratedXmlFile;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.PluginAdapter;

import java.lang.reflect.Field;
import java.util.List;

/**
 * Description: (描述) </br>
 * Date: 2017/7/2下午8:29 </br>
 *
 * @author 姬远玄
 * @since JDK 1.7
 */
public class mybatisMergeablePlugin extends PluginAdapter {
    @Override
    public boolean validate(List warnings) {
        return true;
    }
    @Override
    public boolean sqlMapGenerated(GeneratedXmlFile sqlMap, IntrospectedTable introspectedTable) {
        try {
            Field field = sqlMap.getClass().getDeclaredField("isMergeable");
            field.setAccessible(true);
            field.setBoolean(sqlMap, false);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }
}
